{{layout/logo-heading
	title="Gemini"
	desc="Gemini enterprise issue and ticketing software (https://www.countersoft.com)"
	icon=constants.Icon.Integrations}}

{{#section/base-editor document=document folder=folder page=page busy=waiting isDirty=(action "isDirty") onCancel=(action "onCancel") onAction=(action "onAction")}}
	<div class="grid-container-5-5">
		<div class="grid-cell-1">
			<div class="form-group">
				<label for="gemini-url">Gemini URL</label>
				{{focus-input id="gemini-url" type="text" value=config.url class="form-control"}}
				<small class="form-text text-muted">e.g. http://helpdesk.countersoft.com</small>
			</div>
			<div class="form-group">
				<label>Username</label>
				{{input id="gemini-username" type="text" value=config.username class="form-control"}}
				<small class="form-text text-muted">Gemini Username</small>
			</div>
			<div class="form-group">
				<label for="gemini-apikey">API Key</label>
				{{input id="gemini-apikey" type="password" value=config.APIKey class="form-control"}}
				<small class="form-text text-muted">Gemini user API key (from user profile)</small>
			</div>
			{{ui/ui-button color=constants.Color.Green light=true label=constants.Label.Authenticate onClick=(action "auth")}}
		</div>
		<div class="grid-cell-2">
			{{#if authenticated}}
				<div class="form-group">
					<label>Select Gemini workspace</label>
					<ul class="section-gemini-workspaces">
						{{#each workspaces as |card|}}
							<li class="section-gemini-workspace" id="gemini-workspace-{{card.Id}}">
								{{#attach-tooltip showDelay=1000}}{{card.Title}}{{/attach-tooltip}}
								<div class="section-gemini-card" style="background-color:{{card.Color}};" {{action "onWorkspaceChange" card.Id}}>{{card.Key}}</div>
								{{#if card.selected}}
									<div class="section-gemini-selected-card">&#10003;</div>
								{{/if}}
							</li>
						{{/each}}
					</ul>
				</div>
			{{/if}}
		</div>
	</div>
{{/section/base-editor}}
